#include<iostream>
#include<vector>
#include <algorithm>
using namespace std;
int minOperations(vector<int>& nums, int x) {
    int left = 0, right = 0, n = nums.size();
    long long sum = 0;
    int numsVar = 0, ret = -1;
    for (auto x : nums) numsVar += x;
    long long target = numsVar - x;
    while (right < n)
    {
        sum += nums[right];
        while (sum > target && left <= right)
        {
            sum -= nums[left++];
        }
        if (sum == target) ret = max(ret, right - left + 1);
        right++;
    }
    return ret == -1 ? -1 : n - ret;
}
int main()
{
    vector<int> nums = {};
    return 0;
}